class AigcOrderInfoViewModel:
    def __init__(self, data):
        self.order_number = data.order_number
        self.title = data.title
        self.chars_sum = data.chars_sum
        self.author = data.author
        self.aigc_rate = str(data.rate) + '%'
        self.finished = '检测中' if data.completed == 0 else '已完成'
        self.create_datetime = data.create_datetime
        self.create_time = data.create_time
        self.is_delete = data.is_delete
        self.pdfname = data.pdfname
        self.reduce_completed = data.reduce_completed
        self.reduce_aigc_file = data.reduce_aigc_file


class AigcOrderInfolistView:
    def __init__(self):
        self.code = 0
        self.remain = 0
        self.msg = ''
        self.data = []

    def fill(self, data, remain):
        self.code = 0
        self.msg = ''
        self.remain = remain if remain else 0
        self.count = data.total
        self.data = [AigcOrderInfoViewModel(item) for item in data.items]